<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActionDispatch::TestResponse</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActionDispatch::TestResponse 
            
                <span class="parent">&lt; 
                    
                    <a href="Response.html">ActionDispatch::Response</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/actionpack/lib/action_dispatch/testing/test_response_rb.html">actionpack/lib/action_dispatch/testing/test_response.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<p><a href="Integration.html">Integration</a> test methods such as <a
href="Integration/RequestHelpers.html#method-i-get">ActionDispatch::Integration::RequestHelpers#get</a>
and <a
href="Integration/RequestHelpers.html#method-i-post">ActionDispatch::Integration::RequestHelpers#post</a>
return objects of class <a href="TestResponse.html">TestResponse</a>, which
represent the HTTP response results of the requested controller actions.</p>

<p>See <a href="Response.html">Response</a> for more information on controller
response objects.</p>

    </div>
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>F</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="TestResponse.html#method-c-from_response">from_response</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-from_response">
            
              <b>from_response</b>(response)
            
            <a href="TestResponse.html#method-c-from_response" name="method-c-from_response" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-from_response_source')" id="l_method-c-from_response_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/308517e913ef1e8d9f13e023bc450374b5ed780a/actionpack/lib/action_dispatch/testing/test_response.rb#L9" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-from_response_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/testing/test_response.rb, line 9</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">from_response</span>(<span class="ruby-identifier">response</span>)
  <span class="ruby-identifier">new</span>.<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">resp</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">status</span>  = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span>
    <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">headers</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">headers</span>
    <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">body</span>    = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                        </div>

    </div>
  </body>
</html>    